<ui:composition template="../../templates/template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="content-center">
		
		<h:form>

			<p:growl id="messages" showDetail="true" />

			<p:schedule value="#{scheduleController.eventModel}"
				widgetVar="myschedule">

				<p:ajax event="dateSelect"
					listener="#{scheduleController.onDateSelect}" update="eventDetails"
					oncomplete="eventDialog.show()" />
				<p:ajax event="eventSelect"
					listener="#{scheduleController.onEventSelect}"
					update="eventDetails" oncomplete="eventDialog.show()" />
				<p:ajax event="eventMove"
					listener="#{scheduleController.onEventMove}" update="messages" />
				<p:ajax event="eventResize"
					listener="#{scheduleController.onEventResize}" update="messages" />

			</p:schedule>

			<p:dialog widgetVar="eventDialog" header="Event Details"
				showEffect="clip" hideEffect="clip">
				<h:panelGrid id="eventDetails" columns="2">
					<h:outputLabel for="title" value="Title:" />
					<p:inputText id="title" value="#{scheduleController.event.title}"
						required="true" />

					<h:outputLabel for="from" value="From:" />
					<p:inputMask id="from"
						value="#{scheduleController.event.startDate}" mask="99/99/9999">
						<f:convertDateTime pattern="dd/MM/yyyy" />
					</p:inputMask>

					<h:outputLabel for="to" value="To:" />
					<p:inputMask id="to" value="#{scheduleController.event.endDate}"
						mask="99/99/9999">
						<f:convertDateTime pattern="dd/MM/yyyy" />
					</p:inputMask>

					<h:outputLabel for="allDay" value="All Day:" />
					<h:selectBooleanCheckbox id="allDay"
						value="#{scheduleController.event.allDay}" />

					<p:commandButton type="reset" value="Reset" />
					<p:commandButton value="Save"
						actionListener="#{scheduleController.addEvent}"
						oncomplete="myschedule.update();eventDialog.hide();" />
				</h:panelGrid>
			</p:dialog>

		</h:form>

	</ui:define>
</ui:composition>